package com.macro.mall.model;

import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * mbr_member_score实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MbrMemberScore implements Serializable{
	/**id*/
    @ApiModelProperty(value = "id")
	private Long id; 
	/**会员标识*/
    @ApiModelProperty(value = "会员标识")
	private Long memberId; 
	/**1-课程、2-视频、3-文章、4-服务订单、5-视频订单、6-讲师*/
    @ApiModelProperty(value = "1-课程、2-视频、3-文章、4-服务订单、5-视频订单、6-讲师")
	private Integer targetType;
	/**如果是课程，对应的是课程id,如果是视频，对应的是视频ID*/
    @ApiModelProperty(value = "如果是课程，对应的是课程id,如果是视频，对应的是视频ID,如是订单则是订单id")
	private String targetId;
	/**评论内容*/
    @ApiModelProperty(value = "评论内容")
	private String commentContent; 
	/**评分*/
    @ApiModelProperty(value = "评分")
	private Double score;
	/**标签*/
	@ApiModelProperty(value = "标签")
	private String label;
	/**标签id*/
	@ApiModelProperty(value = "标签id")
	private String tagId;
	/**评论时间*/
    @ApiModelProperty(value = "评论时间")
	private Date createTime; 

	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getMemberId() != null) {
			result.put("memberId",this.getMemberId());
		}
		if (this.getTargetType() != null) {
			result.put("targetType",this.getTargetType());
		}
		if (this.getTargetId() != null) {
			result.put("targetId",this.getTargetId());
		}
		if (this.getCommentContent() != null) {
			result.put("commentContent",this.getCommentContent());
		}
		if (this.getScore() != null) {
			result.put("score",this.getScore());
		}
		if (this.getLabel() != null) {
			result.put("label",this.getLabel());
		}
		if (this.getTagId() != null) {
			result.put("tagId",this.getTagId());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "MbrMemberScore [id=" + id + " , memberId=" + memberId + " , targetType=" + targetType + " , targetId=" + targetId + " , commentContent=" + commentContent + " , score=" + score + " , label=" + label + " , tagId=" + tagId + " , createTime=" + createTime + "  ]";
	
	}
	
	
}
